# -*-coding:utf-8 -*-

import sys
import pygame

from settings import Settings
from ship import Ship

def run_game ():
    """
        初始化pygame，设置屏幕对象，
    """

    pygame.init()
    alin_settings = Settings()
    print(alin_settings)

    screen = pygame.display.set_mode((alin_settings.screen_width, alin_settings.screen_height))
    pygame.display.set_caption("Alien Invasion")

    ship = Ship(screen)

    while True:
        """
            使用while循环，开始游戏
        """
        for evnet in pygame.event.get():
            if evnet.type == pygame.QUIT:
                sys.exit()
        
        screen.fill(alin_settings.bg_color)
        ship.blitme()
        pygame.display.flip()


run_game()




